$(function() {
	var d = $("#sTMB3");
	d.empty();
	for (var c = 0; c < 3; c++) {
		$('<select id="s' + c + '" style="margin:0px 10px;width:80px;border:#B9C2CB 1px solid;"></select>').appendTo(d);
		for (var a = c; a < 28; a++) {
			if (c == 0) {
				if (a != 1 && a != 2) {
					$('<option value="' + a + '">' + a + "</option>").appendTo("#s" + c)
				}
			} else {
				if (c == 1) {
					if (a != 0 && a != 2) {
						$('<option value="' + a + '">' + a + "</option>").appendTo("#s" + c)
					}
				} else {
					$('<option value="' + a + '">' + a + "</option>").appendTo("#s" + c)
				}
			}
		}
		$("#s" + c).change(b).val(c).data("tmpval", c)
	}
	function b() {
		$(this).data("tmpval", $(this).val());
		var e = $("#s0").data("tmpval");
		var k = $("#s1").data("tmpval");
		var h = $("#s2").data("tmpval");
		for (var g = 0; g < 3; g++) {
			$("#s" + g).find("option").remove();
			for (var f = 0; f < 28; f++) {
				if (g == 0 && f != k && f != h) {
					$('<option value="' + f + '">' + f + "</option>").appendTo("#s" + g)
				} else {
					if (g == 1 && f != e && f != h) {
						$('<option value="' + f + '">' + f + "</option>").appendTo("#s" + g)
					} else {
						if (g == 2 && f != e && f != k) {
							$('<option value="' + f + '">' + f + "</option>").appendTo("#s" + g)
						}
					}
				}
			}
		}
		$("#s0").val(e).data("tmpval", e);
		$("#s1").val(k).data("tmpval", k);
		$("#s2").val(h).data("tmpval", h)
	}
});

function getBet(g, j) {
	if (!j) {
		j = $("#t_" + g)
	}
	var c = $("#o_" + g);
	var l = Number(c.text());
	if (isNaN(l) || l <= 0) {
		return
	}
	var f = j.attr("title");
	f = f.split(" ", 2);
	var h = f[1];
	f = (f.length > 1) ? f[0] : "";
	var d = g.split("_");
	var b = {
		title: f,
		game: d[0],
		odds: l
	};
	if (b.game == "TMB3") {
		b.contents = $("#s0").val() + "," + $("#s1").val() + "," + $("#s2").val();
		b.text = h + " " + b.contents
	} else {
		b.contents = d[1];
		b.text = h
	}
	var a = Number(c.attr("lang"));
	if (a > 0) {
		var k = [];
		for (var e = 1; e < a; e++) {
			k[e - 1] = $("#o_" + g + "_" + e).text()
		}
		b.oddsDetail = k
	}
	return b
};